home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 626-650 / 634 / apig / apig33.lzh / bitmapscale.rexx < prev    next >
OS/2 REXX Batch file  |  1992-02-19  |  2KB  |  84 lines

  1.  
  2. /* Example of loading iff pic into custom screen             */
  3. /* then then Scale a BitMap */
  4.  
  5.  
  6. /*  */
  7.  x = addlib("apig.library",0,-30,0)
  8.  
  9.  call set_apig_globals()
  10.  
  11.  scr = 0 
  12.  
  13.  picture    = loadiff("gorilla") 
  14.  if picture = '0000 0000'x then
  15.     do
  16.        say "I could not find that picture"
  17.        exit
  18.     end
  19.  
  20.  width    = iffwidth(picture)
  21.  height   = iffheight(picture)
  22.  depth    = iffdepth(picture)
  23.  viewmode = iffviewmode(picture)
  24.  ncolors  = iffcolors(picture)
  25.  colors   = iffcolortab(picture)
  26.  
  27.  say "Width     = " width
  28.  say "Depth     = " depth 
  29.  say "Height    = " height 
  30.  say "Viewmode  = " viewmode
  31.  say "Numcolors = " ncolors
  32.  say "ColorTab  = " d2x(c2d(colors))
  33.  
  34.  scr   = openscreen(0,0,width,height,depth,1,0,viemode,CUSTOMSCREEN,0)
  35.  scrrp = getscreenrastport(scr) 
  36.  z     = useiffcolor(picture,scr)
  37.  
  38.  /* the following blit copies the IFF image into the screens rastport */
  39.  z     = bltbitmaprastport(picture,0,0,scrrp,0,0,width,height,c2d('00c0'x)) 
  40.  
  41.  wait 2 sec
  42.  
  43.  bmwidth  = width / 2
  44.  bmheight = height / 2
  45.  
  46.  scalewidth  = width / 2
  47.  scaleheight = height / 2
  48.  
  49.  mybitmap = makebitmap(bmwidth,bmheight,depth)
  50.  
  51.  bms = ALLOCVEC(48,MEMF_CLEAR)
  52.  
  53.  call SETVALUE(bms,0,2,'n',0)             /* src X              */
  54.  call SETVALUE(bms,2,2,'n',0)             /* src Y              */
  55.  call SETVALUE(bms,4,2,'n',width)         /* src width          */
  56.  call SETVALUE(bms,6,2,'n',height)        /* src height         */
  57.  call SETVALUE(bms,8,2,'n',width)         /* Xfactor            */
  58.  call SETVALUE(bms,10,2,'n',height)       /* Yfactor            */
  59.  call SETVALUE(bms,12,2,'n',0)            /* dest X             */
  60.  call SETVALUE(bms,14,2,'n',0)            /* dest Y             */
  61.  call SETVALUE(bms,16,2,'n',bmwidth)      /* dest width         */
  62.  call SETVALUE(bms,18,2,'n',bmheight)     /* dest height        */
  63.  call SETVALUE(bms,20,2,'n',scalewidth)   /* Xfactor            */
  64.  call SETVALUE(bms,22,2,'n',scaleheight)  /* Yfactor            */
  65.  call SETVALUE(bms,24,4,'p',picture)      /* source bitmap      */
  66.  call SETVALUE(bms,28,4,'p',mybitmap)     /* destination bitmap */
  67.  
  68.  /* scale it into mybitmap */
  69.  call BITMAPSCALE(bms)
  70.  
  71.  /* blit mybitmap into screen */
  72.  z = bltbitmaprastport(mybitmap,0,0,scrrp,0,0,bmwidth,bmheight,c2d('00c0'x)) 
  73.  
  74.  wait 15 sec
  75.  
  76.  call FREEBITMAP(picture)
  77.  call FREEBITMAP(mybitmap)
  78.  call FREEVEC(bms)
  79.  
  80.  call CLOSESCREEN(scr)
  81.  
  82.  exit 
  83.  
  84.